﻿//------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;

namespace Microsoft.ResourceManagement.Samples.ResourceManagementClient.WSEnumerate
{
    /// <summary>
    /// This class encapsulates a WS-Enumeration Pull.
    /// Please read the spec http://www.w3.org/Submission/WS-Enumeration/
    /// 
    /// A client sends a Pull request in order to receive elements from the server.
    /// A client uses the EnumerationContext from the EnumerateResponse here.
    /// </summary>
    [XmlRoot(ElementName = "Pull", Namespace = Constants.NamespaceWSEnumeration)]
    public class PullRequest
    {
        private String enumerationContext;
        private String maxTime;
        private Int32 maxElements;
        private Int32 maxCharacters;
        private PullAdjustmentType pullAdjustmentField;

        public PullRequest()
        {
            this.EnumerationContext = String.Empty;
            this.MaxCharacters = Int32.MaxValue;
            this.MaxElements = 1;
        }
        
        /// <summary>
        /// The opaque string provided by the server to identify the enumeration context
        /// </summary>
        [XmlElement(ElementName = "EnumerationContext", Type = typeof(String))]
        public String EnumerationContext
        {
            get
            {
                return this.enumerationContext;
            }
            set
            {
                this.enumerationContext = value;
            }
        }

        
        [XmlElement(ElementName = "MaxTime")]
        public String MaxTime
        {
            get
            {
                return this.maxTime;
            }
            set
            {
                this.maxTime = value;
            }
        }

        
        /// <summary>
        /// The max number of elements the client requests to return in this pull
        /// </summary>
        [XmlElement(ElementName = "MaxElements", Type = typeof(Int32))]
        public Int32 MaxElements
        {
            get
            {
                return maxElements;
            }
            set
            {
                this.maxElements = value;
            }
        }
        
        /// <summary>
        /// The max number of characters the client requests to return in this pull.
        /// This will not truncate results, but take precedence when returning elements.
        /// </summary>
        [XmlElement(ElementName = "MaxCharacters", Type = typeof(Int32))]
        public Int32 MaxCharacters
        {
            get
            {
                return this.maxCharacters;
            }
            set
            {
                this.maxCharacters = value;
            }
        }

        [XmlElement(ElementName = "PullAdjustment")]
        public PullAdjustmentType PullAdjustment
        {
            get
            {
                return this.pullAdjustmentField;
            }
            set
            {
                this.pullAdjustmentField = value;
            }
        }

    }
}
